{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "returning-killer",
   "metadata": {},
   "outputs": [],
   "source": [
    "nums = [1,2,3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "genetic-florida",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[] [2, 3]\n",
      "[1] [3]\n",
      "[1, 2] []\n"
     ]
    }
   ],
   "source": [
    "results = []\n",
    "for i, n in enumerate(nums):\n",
    "    first = nums[:i]\n",
    "    second = nums[i+1:]\n",
    "    print(first, second)\n",
    "    target = -1\n",
    "    for the_num in first:\n",
    "        if the_num > n:\n",
    "            target = the_num\n",
    "    for the_num in second:\n",
    "        if the_num > n:\n",
    "            target = the_num\n",
    "    results.append(target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "active-indicator",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[3, 3, -1]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "results"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "coastal-seminar",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/next-greater-element-ii/\n",
    "\n",
    "\n",
    "Output Limit Exceeded\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def nextGreaterElements(self, nums: List[int]) -> List[int]:\n",
    "        #6:52\n",
    "        results = []\n",
    "        for i, n in enumerate(nums):\n",
    "            first = nums[:i]\n",
    "            second = nums[i+1:]\n",
    "            print(first, second)\n",
    "            target = None\n",
    "            for the_num in second:\n",
    "                if the_num > n:\n",
    "                    target = the_num\n",
    "                    break\n",
    "            if target == None:\n",
    "                for the_num in first:\n",
    "                    if the_num > n:\n",
    "                        target = the_num\n",
    "                        break\n",
    "            if target == None:\n",
    "                target = -1\n",
    "            results.append(target)\n",
    "        return results \n",
    "        #done at 7:06; debug done at 7:14\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "greek-effect",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
